package cn.crm.web.controller.business;


import cn.crm.common.annotation.Log;
import cn.crm.common.core.domain.AjaxResult;
import cn.crm.common.enums.BusinessType;
import cn.crm.system.domain.pojo.dto.CaseStatesDto;
import cn.crm.system.domain.pojo.dto.QuotedStatesDto;
import cn.crm.system.service.impl.CaseStatesServiceImpl;
import cn.crm.system.service.impl.QuotedStatesServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/casestates")
@Api(tags = "报价单状态模块")
public class CaseStatesController {
    @Autowired
    private CaseStatesServiceImpl caseStatesService;


    public CaseStatesController() {
        log.debug("创建控制器对象：QuotedStatesController");
    }

    @PreAuthorize("@ss.hasPermi('system:casestates:add')")
    @PostMapping("/add")
    @ApiOperation("添加项目状态")
    @Log(title = "项目状态管理", businessType = BusinessType.INSERT)
    public AjaxResult quotedStates(@RequestBody CaseStatesDto caseStatesDto) {
        log.debug("开始处理添加项目状态的接口");
        int i = caseStatesService.insertCaseStates(caseStatesDto);
        if (i < 1) {
            return AjaxResult.error("添加失败");
        }
        return AjaxResult.success("添加成功");
    }

}
